package com.fantasy.easy.sys.util;
import org.springframework.context.MessageSource;

import com.fantasy.easy.core.SessionSubjectUtils;
import com.fantasy.easy.core.util.SpringUtil;

/**
 * 获取国际化的工具类
 * */
public class I18nMessageUtil {

    private static MessageSource messageSource;

    public static String getMessage(String key) {
        return getMessageSource().getMessage(key, null, key, SessionSubjectUtils.getCurrentLocale());
    }
    
    private static MessageSource getMessageSource() {
    	if(messageSource == null) {
    		messageSource = SpringUtil.getBean(MessageSource.class);
    	}
    	return messageSource;
    }
    
    
}